feat(reports): orientation, cards per row and condensed card options - #61
Merged
Conversation
Card layouts printed one record per page for wide views, which wastes paper on concise ones. Measured on real records, density is driven by card height, not by a fixed rule: 4.0 records per page with a single field, 1.0 with sixteen. Add three layout options that carry through save, preview, print and PDF: - orientation: portrait or landscape, applied both to Dompdf's paper and to the document's @page rule so the browser prints the iframe the same way - card_columns: 1 to 4 cards side by side, laid out as a grid - compact_cards: drops the 80px column floor and tightens padding, margins and the title size Measured on a table with short titles, 40 records: 5.0 per page by default, 8.0 at two columns, 10.0 with condensed cards, 13.3 at four columns in landscape. More columns is not always denser — narrow cards wrap long titles — so the options are exposed rather than guessed at, and the card ones only appear when a view is selected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #60 — please merge that one first; this branch targets it, not
main.Answers the question that came out of #60: is one card per page a fixed rule, or was that specific to a 16-field view?
It was the view
Density is driven by card height. Measured on real Ouvrages records, 40 at a time:
Two things cap it: long titles that wrap to three lines (the same concise view on a short-title table gives 5.0 instead of 3.6), and fixed card chrome — an 80px column floor plus padding and margins — which dominates once the content is small.
What this adds
Three layout options, carried through save, preview, print and PDF:
orientation— portrait or landscape, applied to Dompdf's paper and to the document's@pagerule, so printing the iframe uses the same sheetcard_columns— 1 to 4 cards side by side, laid out as a gridcompact_cards— drops the column floor and tightens padding, margins and title sizeMeasured on short-title records, 40 at a time:
Two notes on the design
More columns is not always denser. On the long-title table, 4 columns is worse than 3 (5.0 vs 5.7) because narrow cards wrap titles harder. That is why these are exposed as options rather than picked automatically — the right setting depends on the data.
I did not implement a fixed "N cards per page". The renderer already packs as many cards as physically fit, so there is no idle space to reclaim; forcing a higher count would mean shrinking cards until content is silently clipped. Cards-per-row reaches the same goal without truncating anything.
The card options only appear once a view is selected; orientation stays available since it applies to table layouts too.
Verification
@pageand the PDF MediaBox (842x595, wider than tall); condensed swaps the 80px floor for 0orientation,card_columnsandcompact_cardsinto the export payload, and the card options stay hidden without a viewtsc -b, ESLint, Prettier all cleanThe live UI walkthrough is the one thing I have not re-run — restarting the dev server dropped my session, and I do not enter passwords. The wiring is covered by the tests above and every option is verified end to end at the API level.